package com.ruoyi.message.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.message.mapper.MessageInfoMapper;
import com.ruoyi.message.domain.MessageInfo;
import com.ruoyi.message.service.IMessageInfoService;

/**
 * 动态Service业务层处理
 * 
 * @author hct
 * @date 2022-04-14
 */
@Service
public class MessageInfoServiceImpl implements IMessageInfoService 
{
    @Autowired
    private MessageInfoMapper messageInfoMapper;

    /**
     * 查询动态
     * 
     * @param id 动态主键
     * @return 动态
     */
    @Override
    public MessageInfo selectMessageInfoById(Long id)
    {
        return messageInfoMapper.selectMessageInfoById(id);
    }

    /**
     * 查询动态列表
     * 
     * @param messageInfo 动态
     * @return 动态
     */
    @Override
    public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo)
    {
        return messageInfoMapper.selectMessageInfoList(messageInfo);
    }

    /**
     * 新增动态
     * 
     * @param messageInfo 动态
     * @return 结果
     */
    @Override
    public int insertMessageInfo(MessageInfo messageInfo)
    {
        return messageInfoMapper.insertMessageInfo(messageInfo);
    }

    /**
     * 修改动态
     * 
     * @param messageInfo 动态
     * @return 结果
     */
    @Override
    public int updateMessageInfo(MessageInfo messageInfo)
    {
        return messageInfoMapper.updateMessageInfo(messageInfo);
    }

    /**
     * 批量删除动态
     * 
     * @param ids 需要删除的动态主键
     * @return 结果
     */
    @Override
    public int deleteMessageInfoByIds(Long[] ids)
    {
        return messageInfoMapper.deleteMessageInfoByIds(ids);
    }

    /**
     * 删除动态信息
     * 
     * @param id 动态主键
     * @return 结果
     */
    @Override
    public int deleteMessageInfoById(Long id)
    {
        return messageInfoMapper.deleteMessageInfoById(id);
    }

    /**
     * 信息的阅读数增加1
     */
    public Boolean updateIsReadAddById(Long id) {
        return messageInfoMapper.updateIsReadAddById(id) > 0;
    }
    public  Boolean updateIsCollectAddById(Long id) {
        return messageInfoMapper.updateIsCollectAddById(id) > 0;
    }

    public  Boolean updateIsCollectSubById(Long id) {
        return messageInfoMapper.updateIsCollectSubById(id) > 0;
    }

    public  Boolean updateIsZanAddById(Long id) {
        return messageInfoMapper.updateIsZanAddById(id) > 0;
    }


    public  Boolean updateIsReplySubById(Long id) {
        return messageInfoMapper.updateIsReplySubById(id) > 0;
    }


    public  Boolean updateIsReplyAddById(Long id) {
        return messageInfoMapper.updateIsReplyAddById(id) > 0;
    }


    public  Boolean updateIsZanSubById(Long id) {
        return messageInfoMapper.updateIsZanSubById(id) > 0;
    }


}
